From: Timo Tijhof Date: Sun, 31 May 2015 15:30:01 +0000 (+0100) Subject: specials: Simplify return logic of various SpecialUserlogin methods X-Git-Tag: 1.31.0-rc.0~11087^2 X-Git-Url: http://git.cyclocoop.org//%22http:/%22.attribut_html%28%24lesurls%5B%24numero%5D%29.%22/%22?a=commitdiff_plain;h=9d323de4c5e88eb85a497203d15c254e4a258aa7;p=lhc%2Fweb%2Fwiklou.git specials: Simplify return logic of various SpecialUserlogin methods * Handle exceptional case before common case in makeLanguageSelector by using early returns. Better reflects the intended effect of the exception by making it harder to accidentally run code after the 'else' statement. Change-Id: I710a94adf22bc4e6dc539e12c69e4ba96bf1068c --- diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 64a6f7244e..8259718e6f 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -1529,7 +1529,6 @@ class LoginForm extends SpecialPage { */ public static function getCreateaccountToken() { global $wgRequest; - return $wgRequest->getSessionData( 'wsCreateaccountToken' ); } @@ -1604,22 +1603,21 @@ class LoginForm extends SpecialPage { */ function makeLanguageSelector() { $msg = $this->msg( 'loginlanguagelinks' )->inContentLanguage(); - if ( !$msg->isBlank() ) { - $langs = explode( "\n", $msg->text() ); - $links = array(); - foreach ( $langs as $lang ) { - $lang = trim( $lang, '* ' ); - $parts = explode( '|', $lang ); - if ( count( $parts ) >= 2 ) { - $links[] = $this->makeLanguageSelectorLink( $parts[0], trim( $parts[1] ) ); - } - } - - return count( $links ) > 0 ? $this->msg( 'loginlanguagelabel' )->rawParams( - $this->getLanguage()->pipeList( $links ) )->escaped() : ''; - } else { + if ( $msg->isBlank() ) { return ''; } + $langs = explode( "\n", $msg->text() ); + $links = array(); + foreach ( $langs as $lang ) { + $lang = trim( $lang, '* ' ); + $parts = explode( '|', $lang ); + if ( count( $parts ) >= 2 ) { + $links[] = $this->makeLanguageSelectorLink( $parts[0], trim( $parts[1] ) ); + } + } + + return count( $links ) > 0 ? $this->msg( 'loginlanguagelabel' )->rawParams( + $this->getLanguage()->pipeList( $links ) )->escaped() : ''; } /**